﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HuongDoiTuong
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int [] arr = { 1, 2, 3, 4, 5, 6,7, 78, 9, 90 };
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (var item in arr.Where(n=>n%2 ==0))
            {
               textBox1.Text += item.ToString()+",";
               
            }
          
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int kt = 0;
           // KT();
            //if (KT())
            //    MessageBox.Show("So nguyen to la "+textBox1.Text+":");
            for (int i = 2; i > arr.Count(); i++)
            {
                foreach (var item in arr.Where(n=>n%i == 0))
                {
                    textBox1.Text += item.ToString()+":";
                }
            }
        }

        public bool KT()
        {
            //for (int i = 2; i < arr.Select(n=>n%i==0,i); i++)
            //{
            //    textBox1.Text += i.ToString()+":";
            //}
            return true;
        }

    }
}
